{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "pid_traindata = pd.read_csv(\"pid_traindata_sample.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "LLC_FEATURES = [\n",
    "    'pitch-deg',  # 飞机俯仰角\n",
    "    'roll-deg',  # 飞机滚转角\n",
    "    'heading-deg',  # 飞机朝向\n",
    "    'vsi-fpm',  # 爬升速度\n",
    "    'uBody-fps',  # 飞机沿机身X轴的速度\n",
    "    'vBody-fps',  # 飞机沿机身Y轴的速度\n",
    "    'wBody-fps',  # 飞机沿机身Z轴的速度\n",
    "    'x-accel-fps_sec',  # 飞机沿机身X轴的加速度\n",
    "    'y-accel-fps_sec',  # 飞机沿机身Y轴的加速度\n",
    "    'z-accel-fps_sec',  # 飞机沿机身z轴的加速度\n",
    "]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "DATA_BOUNDS = {\n",
    "    'pitch-deg': [-90., 90.],  # 飞机俯仰角\n",
    "    'roll-deg': [-180., 180.],  # 飞机滚转角\n",
    "    'heading-deg': [0., 360.],  # 飞机朝向\n",
    "    'vsi-fpm': [0., 10.0],  # 爬升速度\n",
    "    'uBody-fps': [0., 600.],  # 飞机沿机身X轴的速度\n",
    "    'vBody-fps': [-200., 200.],  # 飞机沿机身Y轴的速度\n",
    "    'wBody-fps': [-200., 200.],  # 飞机沿机身Z轴的速度\n",
    "    'x-accel-fps_sec': [0., 50.],  # 飞机沿机身X轴的加速度\n",
    "    'y-accel-fps_sec': [-30., 30.],  # 飞机沿机身Y轴的加速度\n",
    "    'z-accel-fps_sec': [-300., 300.],  # 飞机沿机身z轴的加速度\n",
    "    'aileron': [-1, 1],  # 副翼 控制飞机翻滚 [-1,1] left/right\n",
    "    'elevator': [-1, 1],  # 升降舵 控制飞机爬升 [-1,1] up/down\n",
    "    'rudder': [-1, 1],  # 方向舵 控制飞机转弯（地面飞机方向控制） 0 /enter\n",
    "    'throttle0': [0, 1],  # 油门0\n",
    "    'throttle1': [0, 1],  # 油门1\n",
    "    'flaps': [0, 1], # 襟翼 在飞机起降过程中增加升力，阻力  Key[ / ]\tExtend / retract flaps\n",
    "    #TODO: 方向舵调整片\n",
    "    'a_aileron': [-1, 1],  # 副翼 控制飞机翻滚 [-1,1] left/right\n",
    "    'a_elevator': [-1, 1],  # 升降舵 控制飞机爬升 [-1,1] up/down\n",
    "    'a_rudder': [-1, 1],  # 方向舵 控制飞机转弯（地面飞机方向控制） 0 /enter\n",
    "    'a_throttle0': [0, 1],  # 油门0\n",
    "    'a_throttle1': [0, 1],  # 油门1\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_bounds = pd.DataFrame.from_dict(DATA_BOUNDS)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>pitch-deg</th>\n",
       "      <th>roll-deg</th>\n",
       "      <th>heading-deg</th>\n",
       "      <th>vsi-fpm</th>\n",
       "      <th>uBody-fps</th>\n",
       "      <th>vBody-fps</th>\n",
       "      <th>wBody-fps</th>\n",
       "      <th>x-accel-fps_sec</th>\n",
       "      <th>y-accel-fps_sec</th>\n",
       "      <th>z-accel-fps_sec</th>\n",
       "      <th>...</th>\n",
       "      <th>elevator</th>\n",
       "      <th>rudder</th>\n",
       "      <th>throttle0</th>\n",
       "      <th>throttle1</th>\n",
       "      <th>flaps</th>\n",
       "      <th>a_aileron</th>\n",
       "      <th>a_elevator</th>\n",
       "      <th>a_rudder</th>\n",
       "      <th>a_throttle0</th>\n",
       "      <th>a_throttle1</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-90.0</td>\n",
       "      <td>-180.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-200.0</td>\n",
       "      <td>-200.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-30.0</td>\n",
       "      <td>-300.0</td>\n",
       "      <td>...</td>\n",
       "      <td>-1</td>\n",
       "      <td>-1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>-1</td>\n",
       "      <td>-1</td>\n",
       "      <td>-1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>90.0</td>\n",
       "      <td>180.0</td>\n",
       "      <td>360.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>600.0</td>\n",
       "      <td>200.0</td>\n",
       "      <td>200.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>30.0</td>\n",
       "      <td>300.0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   pitch-deg  roll-deg  heading-deg  vsi-fpm  uBody-fps  vBody-fps  wBody-fps  \\\n",
       "0      -90.0    -180.0          0.0      0.0        0.0     -200.0     -200.0   \n",
       "1       90.0     180.0        360.0     10.0      600.0      200.0      200.0   \n",
       "\n",
       "   x-accel-fps_sec  y-accel-fps_sec  z-accel-fps_sec     ...       elevator  \\\n",
       "0              0.0            -30.0           -300.0     ...             -1   \n",
       "1             50.0             30.0            300.0     ...              1   \n",
       "\n",
       "   rudder  throttle0  throttle1  flaps  a_aileron  a_elevator  a_rudder  \\\n",
       "0      -1          0          0      0         -1          -1        -1   \n",
       "1       1          1          1      1          1           1         1   \n",
       "\n",
       "   a_throttle0  a_throttle1  \n",
       "0            0            0  \n",
       "1            1            1  \n",
       "\n",
       "[2 rows x 21 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_bounds"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a_aileron                0.848693\n",
       "a_elevator               0.406004\n",
       "a_rudder                 0.907000\n",
       "a_throttle0              0.010000\n",
       "a_throttle1              0.010000\n",
       "ai-offset                     NaN\n",
       "ai-pitch                      NaN\n",
       "ai-roll                       NaN\n",
       "aileron                  0.848693\n",
       "airspeed-kt                   NaN\n",
       "alt-ft                        NaN\n",
       "altitude                      NaN\n",
       "crashed                       NaN\n",
       "down-accel-fps_sec            NaN\n",
       "east-accel-fps_sec            NaN\n",
       "elevator                 0.406004\n",
       "flaps                    0.000000\n",
       "heading-deg             89.992182\n",
       "hi-heading                    NaN\n",
       "latitude                      NaN\n",
       "longitude                     NaN\n",
       "north-accel-fps_sec           NaN\n",
       "pitch-deg               90.372688\n",
       "roll-deg               178.511568\n",
       "rudder                   0.907000\n",
       "speed-down-fps                NaN\n",
       "speed-east-fps                NaN\n",
       "speed-north-fps               NaN\n",
       "throttle0                0.000000\n",
       "throttle1                0.000000\n",
       "uBody-fps                0.000000\n",
       "vBody-fps              190.768641\n",
       "vsi-fpm                  0.000000\n",
       "wBody-fps              200.000000\n",
       "x-accel-fps_sec          0.000000\n",
       "y-accel-fps_sec         29.230948\n",
       "z-accel-fps_sec        224.386726\n",
       "dtype: float64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(pid_traindata - data_bounds.min()).min()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a_aileron                1.148843\n",
       "a_elevator               1.090589\n",
       "a_rudder                 1.035000\n",
       "a_throttle0              0.600000\n",
       "a_throttle1              0.600000\n",
       "ai-offset                     NaN\n",
       "ai-pitch                      NaN\n",
       "ai-roll                       NaN\n",
       "aileron                  1.148843\n",
       "airspeed-kt                   NaN\n",
       "alt-ft                        NaN\n",
       "altitude                      NaN\n",
       "crashed                       NaN\n",
       "down-accel-fps_sec            NaN\n",
       "east-accel-fps_sec            NaN\n",
       "elevator                 1.090589\n",
       "flaps                    0.000000\n",
       "heading-deg             93.015763\n",
       "hi-heading                    NaN\n",
       "latitude                      NaN\n",
       "longitude                     NaN\n",
       "north-accel-fps_sec           NaN\n",
       "pitch-deg              113.129216\n",
       "roll-deg               181.513065\n",
       "rudder                   1.035000\n",
       "speed-down-fps                NaN\n",
       "speed-east-fps                NaN\n",
       "speed-north-fps               NaN\n",
       "throttle0                0.600000\n",
       "throttle1                0.600000\n",
       "uBody-fps              436.408020\n",
       "vBody-fps              200.000588\n",
       "vsi-fpm                  0.000000\n",
       "wBody-fps              261.257980\n",
       "x-accel-fps_sec         14.900751\n",
       "y-accel-fps_sec         33.692399\n",
       "z-accel-fps_sec        277.892965\n",
       "dtype: float64"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(pid_traindata - data_bounds.min()).max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "res = ((pid_traindata - data_bounds.min())/(data_bounds.max() - data_bounds.min())).dropna(axis=1,how=\"any\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.5744216 , 0.54529429, 0.5175    , 0.6       , 0.6       ,\n",
       "       0.5744215 , 0.5452945 , 0.        , 0.25837712, 0.62849564,\n",
       "       0.50420296, 0.5175    , 0.6       , 0.6       , 0.7273467 ,\n",
       "       0.50000147, 0.        , 0.65314495, 0.29801502, 0.56153998,\n",
       "       0.46315494])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "info= pd.concat([res.min(),res.max()], axis=1)\n",
    "np.array(info[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a_aileron                    NaN\n",
       "a_elevator                   NaN\n",
       "a_rudder                     NaN\n",
       "a_throttle0                  NaN\n",
       "a_throttle1                  NaN\n",
       "ai-offset                    NaN\n",
       "ai-pitch                     NaN\n",
       "ai-roll                      NaN\n",
       "aileron                      NaN\n",
       "airspeed-kt                  NaN\n",
       "alt-ft                       NaN\n",
       "altitude                     NaN\n",
       "crashed                      NaN\n",
       "down-accel-fps_sec           NaN\n",
       "east-accel-fps_sec           NaN\n",
       "elevator                     NaN\n",
       "flaps                        NaN\n",
       "heading-deg           -89.741623\n",
       "hi-heading                   NaN\n",
       "latitude                     NaN\n",
       "longitude                    NaN\n",
       "north-accel-fps_sec          NaN\n",
       "pitch-deg               0.204496\n",
       "roll-deg                0.504203\n",
       "rudder                       NaN\n",
       "speed-down-fps               NaN\n",
       "speed-east-fps               NaN\n",
       "speed-north-fps              NaN\n",
       "throttle0                    NaN\n",
       "throttle1                    NaN\n",
       "uBody-fps               0.727347\n",
       "vBody-fps               0.500001\n",
       "vsi-fpm                 0.000000\n",
       "wBody-fps               0.653145\n",
       "x-accel-fps_sec         0.298015\n",
       "y-accel-fps_sec         0.561540\n",
       "z-accel-fps_sec        32.463155\n",
       "dtype: float64"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "state = info.T.loc[1,LLC_FEATURES] - pid_traindata.loc[0]\n",
    "state"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "tmp=(res- res.min())**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tmp.sum(axis=1).idxmin()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a_aileron          0.500000\n",
       "a_elevator         0.500000\n",
       "a_rudder           0.500000\n",
       "a_throttle0        0.010000\n",
       "a_throttle1        0.010000\n",
       "aileron            0.500000\n",
       "elevator           0.500000\n",
       "flaps              0.000000\n",
       "heading-deg        0.250000\n",
       "pitch-deg          0.502356\n",
       "roll-deg           0.500000\n",
       "rudder             0.500000\n",
       "throttle0          0.000000\n",
       "throttle1          0.000000\n",
       "uBody-fps          0.000000\n",
       "vBody-fps          0.500000\n",
       "vsi-fpm            0.000000\n",
       "wBody-fps          0.500000\n",
       "x-accel-fps_sec    0.000000\n",
       "y-accel-fps_sec    0.500000\n",
       "z-accel-fps_sec    0.446667\n",
       "Name: 0, dtype: float64"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "res.loc[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "pid_traindata[\"fly_mode\"] = (pid_traindata.loc[:,[\"altitude\"]] > 23).astype(int) + (pid_traindata.loc[:,[\"altitude\"]] > 6000).astype(int)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "groups = pid_traindata.groupby(\"fly_mode\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "     aileron  elevator  rudder  flaps  throttle0  throttle1  vsi-fpm  \\\n",
      "135      0.0       0.0  -0.009    0.0       0.60       0.60      0.0   \n",
      "34       0.0       0.0   0.000    0.0       0.17       0.17      0.0   \n",
      "345      0.0       0.0  -0.029    0.0       0.60       0.60      0.0   \n",
      "54       0.0       0.0   0.000    0.0       0.21       0.21      0.0   \n",
      "375      0.0       0.0  -0.043    0.0       0.60       0.60      0.0   \n",
      "96       0.0       0.0  -0.018    0.0       0.42       0.42      0.0   \n",
      "264      0.0       0.0  -0.023    0.0       0.60       0.60      0.0   \n",
      "206      0.0       0.0  -0.020    0.0       0.60       0.60      0.0   \n",
      "215      0.0       0.0  -0.024    0.0       0.60       0.60      0.0   \n",
      "310      0.0       0.0  -0.027    0.0       0.60       0.60      0.0   \n",
      "202      0.0       0.0  -0.018    0.0       0.60       0.60      0.0   \n",
      "104      0.0       0.0  -0.018    0.0       0.46       0.46      0.0   \n",
      "179      0.0       0.0  -0.016    0.0       0.60       0.60      0.0   \n",
      "317      0.0       0.0  -0.026    0.0       0.60       0.60      0.0   \n",
      "120      0.0       0.0  -0.014    0.0       0.54       0.54      0.0   \n",
      "89       0.0       0.0  -0.014    0.0       0.39       0.39      0.0   \n",
      "39       0.0       0.0   0.000    0.0       0.14       0.14      0.0   \n",
      "24       0.0       0.0   0.000    0.0       0.12       0.12      0.0   \n",
      "228      0.0       0.0  -0.024    0.0       0.60       0.60      0.0   \n",
      "299      0.0       0.0  -0.024    0.0       0.60       0.60      0.0   \n",
      "74       0.0       0.0  -0.007    0.0       0.31       0.31      0.0   \n",
      "52       0.0       0.0   0.000    0.0       0.20       0.20      0.0   \n",
      "274      0.0       0.0  -0.025    0.0       0.60       0.60      0.0   \n",
      "10       0.0       0.0   0.000    0.0       0.05       0.05      0.0   \n",
      "324      0.0       0.0  -0.025    0.0       0.60       0.60      0.0   \n",
      "62       0.0       0.0  -0.001    0.0       0.25       0.25      0.0   \n",
      "332      0.0       0.0  -0.027    0.0       0.60       0.60      0.0   \n",
      "278      0.0       0.0  -0.024    0.0       0.60       0.60      0.0   \n",
      "359      0.0       0.0  -0.032    0.0       0.60       0.60      0.0   \n",
      "219      0.0       0.0  -0.024    0.0       0.60       0.60      0.0   \n",
      "343      0.0       0.0  -0.028    0.0       0.60       0.60      0.0   \n",
      "30       0.0       0.0   0.000    0.0       0.15       0.15      0.0   \n",
      "341      0.0       0.0  -0.028    0.0       0.60       0.60      0.0   \n",
      "71       0.0       0.0  -0.005    0.0       0.30       0.30      0.0   \n",
      "266      0.0       0.0  -0.023    0.0       0.60       0.60      0.0   \n",
      "304      0.0       0.0  -0.025    0.0       0.60       0.60      0.0   \n",
      "139      0.0       0.0  -0.011    0.0       0.60       0.60      0.0   \n",
      "191      0.0       0.0  -0.016    0.0       0.60       0.60      0.0   \n",
      "\n",
      "         alt-ft  ai-pitch   ai-roll    ...      latitude   longitude  \\\n",
      "135 -365.370544  0.422823  0.053573    ...     21.325247 -157.942452   \n",
      "34   -66.825806  0.456921  0.056273    ...     21.325247 -157.943071   \n",
      "345 -371.995575  0.380283  0.063505    ...     21.325244 -157.934090   \n",
      "54  -128.244003  0.451945  0.056062    ...     21.325247 -157.943026   \n",
      "375 -372.060669  0.372922  0.077881    ...     21.325244 -157.932038   \n",
      "96  -258.194183  0.438092  0.055254    ...     21.325247 -157.942846   \n",
      "264 -372.283051  0.400822  0.050454    ...     21.325244 -157.938584   \n",
      "206 -372.632446  0.410221  0.047680    ...     21.325246 -157.940814   \n",
      "215 -372.578461  0.410197  0.049080    ...     21.325245 -157.940529   \n",
      "310 -372.055603  0.386720  0.056525    ...     21.325244 -157.936230   \n",
      "202 -372.659088  0.409420  0.047616    ...     21.325246 -157.940945   \n",
      "104 -282.533722  0.433741  0.054964    ...     21.325247 -157.942789   \n",
      "179 -372.731964  0.413518  0.051426    ...     21.325246 -157.941576   \n",
      "317 -372.033966  0.388478  0.055761    ...     21.325244 -157.935792   \n",
      "120 -334.391510  0.426998  0.055664    ...     21.325247 -157.942635   \n",
      "89  -234.301239  0.440862  0.055498    ...     21.325247 -157.942892   \n",
      "39   -76.786903  0.455934  0.056248    ...     21.325247 -157.943064   \n",
      "24   -35.331364  0.620597  0.597215    ...     21.325247 -157.943092   \n",
      "228 -372.499481  0.405917  0.048134    ...     21.325245 -157.940071   \n",
      "299 -372.097412  0.392227  0.053046    ...     21.325244 -157.936839   \n",
      "74  -187.439102  0.445659  0.055890    ...     21.325247 -157.942964   \n",
      "52  -120.869011  0.452655  0.056106    ...     21.325247 -157.943032   \n",
      "274 -372.222351  0.401427  0.051528    ...     21.325244 -157.938103   \n",
      "10    -0.473568  3.009778  9.837182    ...     21.325247 -157.943118   \n",
      "324 -372.018585  0.387424  0.059133    ...     21.325244 -157.935393   \n",
      "62  -153.146988  0.449393  0.055963    ...     21.325247 -157.943003   \n",
      "332 -372.003632  0.384931  0.060219    ...     21.325244 -157.934888   \n",
      "278 -372.197693  0.397054  0.051155    ...     21.325244 -157.937896   \n",
      "359 -372.010681  0.377755  0.066607    ...     21.325244 -157.933149   \n",
      "219 -372.551941  0.407557  0.048783    ...     21.325245 -157.940384   \n",
      "343 -371.995514  0.381192  0.061191    ...     21.325244 -157.934198   \n",
      "30   -53.890556  0.460374  0.063779    ...     21.325247 -157.943079   \n",
      "341 -371.996094  0.382245  0.062484    ...     21.325244 -157.934360   \n",
      "71  -179.320023  0.446507  0.055942    ...     21.325247 -157.942974   \n",
      "266 -372.267609  0.400439  0.050939    ...     21.325244 -157.938466   \n",
      "304 -372.076935  0.391570  0.052912    ...     21.325244 -157.936561   \n",
      "139 -368.344604  0.421588  0.053325    ...     21.325247 -157.942389   \n",
      "191 -372.707581  0.413892  0.050182    ...     21.325246 -157.941286   \n",
      "\n",
      "      altitude  crashed  a_aileron  a_elevator  a_rudder  a_throttle0  \\\n",
      "135  21.563792      0.0   0.000000    0.000000    -0.010         0.60   \n",
      "34   21.376058      0.0   0.000000    0.000000     0.000         0.18   \n",
      "345  22.809092      0.0   0.000000    0.000000    -0.030         0.60   \n",
      "54   21.389290      0.0   0.000000    0.000000     0.000         0.22   \n",
      "375  22.748339      0.0  -0.007769   -0.593996    -0.043         0.60   \n",
      "96   21.443918      0.0   0.000000    0.000000    -0.018         0.43   \n",
      "264  22.451115      0.0   0.000000    0.000000    -0.023         0.60   \n",
      "206  22.010385      0.0   0.000000    0.000000    -0.021         0.60   \n",
      "215  22.078158      0.0   0.000000    0.000000    -0.024         0.60   \n",
      "310  22.726524      0.0   0.000000    0.000000    -0.027         0.60   \n",
      "202  21.979049      0.0   0.000000    0.000000    -0.019         0.60   \n",
      "104  21.460953      0.0   0.000000    0.000000    -0.018         0.47   \n",
      "179  21.812109      0.0   0.000000    0.000000    -0.016         0.60   \n",
      "317  22.753675      0.0   0.000000    0.000000    -0.026         0.60   \n",
      "120  21.508219      0.0   0.000000    0.000000    -0.014         0.55   \n",
      "89   21.429420      0.0   0.000000    0.000000    -0.015         0.40   \n",
      "39   21.377913      0.0   0.000000    0.000000     0.000         0.15   \n",
      "24   21.369758      0.0   0.000000    0.000000     0.000         0.13   \n",
      "228  22.175246      0.0   0.000000    0.000000    -0.024         0.60   \n",
      "299  22.676301      0.0   0.000000    0.000000    -0.024         0.60   \n",
      "74   21.407522      0.0   0.000000    0.000000    -0.008         0.32   \n",
      "52   21.387478      0.0   0.000000    0.000000     0.000         0.21   \n",
      "274  22.527509      0.0   0.000000    0.000000    -0.025         0.60   \n",
      "10   21.359172      0.0   0.000000    0.000000     0.000         0.06   \n",
      "324  22.775110      0.0   0.000000    0.000000    -0.026         0.60   \n",
      "62   21.396034      0.0   0.000000    0.000000    -0.002         0.26   \n",
      "332  22.796950      0.0   0.000000    0.000000    -0.027         0.60   \n",
      "278  22.555480      0.0   0.000000    0.000000    -0.023         0.60   \n",
      "359  22.798003      0.0   0.000000    0.000000    -0.032         0.60   \n",
      "219  22.111328      0.0   0.000000    0.000000    -0.024         0.60   \n",
      "343  22.809026      0.0   0.000000    0.000000    -0.029         0.60   \n",
      "30   21.373695      0.0   0.000000    0.000000     0.000         0.16   \n",
      "341  22.807415      0.0   0.000000    0.000000    -0.028         0.60   \n",
      "71   21.404506      0.0   0.000000    0.000000    -0.006         0.31   \n",
      "266  22.469675      0.0   0.000000    0.000000    -0.024         0.60   \n",
      "304  22.701414      0.0   0.000000    0.000000    -0.026         0.60   \n",
      "139  21.582981      0.0   0.000000    0.000000    -0.011         0.60   \n",
      "191  21.890031      0.0   0.000000    0.000000    -0.016         0.60   \n",
      "\n",
      "     a_throttle1  fly_mode  \n",
      "135         0.60         0  \n",
      "34          0.18         0  \n",
      "345         0.60         0  \n",
      "54          0.22         0  \n",
      "375         0.60         0  \n",
      "96          0.43         0  \n",
      "264         0.60         0  \n",
      "206         0.60         0  \n",
      "215         0.60         0  \n",
      "310         0.60         0  \n",
      "202         0.60         0  \n",
      "104         0.47         0  \n",
      "179         0.60         0  \n",
      "317         0.60         0  \n",
      "120         0.55         0  \n",
      "89          0.40         0  \n",
      "39          0.15         0  \n",
      "24          0.13         0  \n",
      "228         0.60         0  \n",
      "299         0.60         0  \n",
      "74          0.32         0  \n",
      "52          0.21         0  \n",
      "274         0.60         0  \n",
      "10          0.06         0  \n",
      "324         0.60         0  \n",
      "62          0.26         0  \n",
      "332         0.60         0  \n",
      "278         0.60         0  \n",
      "359         0.60         0  \n",
      "219         0.60         0  \n",
      "343         0.60         0  \n",
      "30          0.16         0  \n",
      "341         0.60         0  \n",
      "71          0.31         0  \n",
      "266         0.60         0  \n",
      "304         0.60         0  \n",
      "139         0.60         0  \n",
      "191         0.60         0  \n",
      "\n",
      "[38 rows x 38 columns]\n",
      "       aileron  elevator  rudder  flaps  throttle0  throttle1  vsi-fpm  \\\n",
      "1127  0.030422 -0.263033  -0.035    0.0        0.6        0.6      0.0   \n",
      "705   0.013140 -0.348842  -0.005    0.0        0.6        0.6      0.0   \n",
      "1244 -0.006201 -0.238300  -0.005    0.0        0.6        0.6      0.0   \n",
      "2348 -0.002597 -0.037527  -0.010    0.0        0.6        0.6      0.0   \n",
      "1723  0.010930 -0.142346  -0.010    0.0        0.6        0.6      0.0   \n",
      "1829  0.019397 -0.122481  -0.035    0.0        0.6        0.6      0.0   \n",
      "1909  0.005120 -0.108019  -0.030    0.0        0.6        0.6      0.0   \n",
      "1548  0.006931 -0.176421  -0.010    0.0        0.6        0.6      0.0   \n",
      "1678 -0.000383 -0.150931   0.000    0.0        0.6        0.6      0.0   \n",
      "2044  0.015298 -0.084707  -0.030    0.0        0.6        0.6      0.0   \n",
      "2440  0.000536 -0.066726   0.000    0.0        0.6        0.6      0.0   \n",
      "978  -0.024977 -0.294703   0.025    0.0        0.6        0.6      0.0   \n",
      "2553 -0.000015 -0.157416   0.000    0.0        0.6        0.6      0.0   \n",
      "1860 -0.001782 -0.116946  -0.005    0.0        0.6        0.6      0.0   \n",
      "2490 -0.000134 -0.103461   0.000    0.0        0.6        0.6      0.0   \n",
      "403   0.049385 -0.429121  -0.093    0.0        0.6        0.6      0.0   \n",
      "759  -0.002369 -0.343422  -0.005    0.0        0.6        0.6      0.0   \n",
      "2146 -0.001857 -0.067987  -0.005    0.0        0.6        0.6      0.0   \n",
      "1035  0.021107 -0.282987  -0.015    0.0        0.6        0.6      0.0   \n",
      "813   0.001657 -0.332474  -0.025    0.0        0.6        0.6      0.0   \n",
      "1672  0.020618 -0.152085  -0.010    0.0        0.6        0.6      0.0   \n",
      "2514 -0.000066 -0.133367   0.000    0.0        0.6        0.6      0.0   \n",
      "1062  0.005872 -0.277162   0.010    0.0        0.6        0.6      0.0   \n",
      "2508 -0.000015 -0.126527   0.000    0.0        0.6        0.6      0.0   \n",
      "839   0.022424 -0.326034  -0.015    0.0        0.6        0.6      0.0   \n",
      "2045  0.018577 -0.084564  -0.030    0.0        0.6        0.6      0.0   \n",
      "1494  0.024810 -0.187281  -0.030    0.0        0.6        0.6      0.0   \n",
      "2008 -0.014329 -0.090707   0.020    0.0        0.6        0.6      0.0   \n",
      "1730  0.009788 -0.140899  -0.005    0.0        0.6        0.6      0.0   \n",
      "936   0.030086 -0.303054  -0.025    0.0        0.6        0.6      0.0   \n",
      "...        ...       ...     ...    ...        ...        ...      ...   \n",
      "1929  0.001590 -0.104527   0.000    0.0        0.6        0.6      0.0   \n",
      "411   0.133229 -0.420779  -0.070    0.0        0.6        0.6      0.0   \n",
      "1325  0.006829 -0.221678   0.000    0.0        0.6        0.6      0.0   \n",
      "2324  0.013369 -0.040964  -0.020    0.0        0.6        0.6      0.0   \n",
      "1779  0.000836 -0.131756   0.005    0.0        0.6        0.6      0.0   \n",
      "1685 -0.007620 -0.149647  -0.005    0.0        0.6        0.6      0.0   \n",
      "1284  0.013486 -0.230204  -0.010    0.0        0.6        0.6      0.0   \n",
      "2284 -0.018483 -0.046771   0.010    0.0        0.6        0.6      0.0   \n",
      "1290  0.013849 -0.228946  -0.010    0.0        0.6        0.6      0.0   \n",
      "751  -0.004637 -0.344340  -0.005    0.0        0.6        0.6      0.0   \n",
      "1066  0.004906 -0.276430   0.020    0.0        0.6        0.6      0.0   \n",
      "1301 -0.001258 -0.226637  -0.025    0.0        0.6        0.6      0.0   \n",
      "445   0.034787 -0.376965  -0.070    0.0        0.6        0.6      0.0   \n",
      "551  -0.003948 -0.397958   0.010    0.0        0.6        0.6      0.0   \n",
      "810   0.006363 -0.333319  -0.015    0.0        0.6        0.6      0.0   \n",
      "1411  0.025726 -0.204359  -0.025    0.0        0.6        0.6      0.0   \n",
      "466   0.029668 -0.369004  -0.070    0.0        0.6        0.6      0.0   \n",
      "539  -0.005431 -0.395639   0.010    0.0        0.6        0.6      0.0   \n",
      "1917  0.028332 -0.106489  -0.030    0.0        0.6        0.6      0.0   \n",
      "544  -0.006735 -0.396889   0.005    0.0        0.6        0.6      0.0   \n",
      "2153  0.017091 -0.066881  -0.010    0.0        0.6        0.6      0.0   \n",
      "2345 -0.010480 -0.037982  -0.005    0.0        0.6        0.6      0.0   \n",
      "1760  0.005918 -0.135253  -0.005    0.0        0.6        0.6      0.0   \n",
      "1001  0.013370 -0.290092  -0.010    0.0        0.6        0.6      0.0   \n",
      "2150  0.014556 -0.067313  -0.005    0.0        0.6        0.6      0.0   \n",
      "2164 -0.004959 -0.065143  -0.025    0.0        0.6        0.6      0.0   \n",
      "2334  0.003794 -0.039530   0.005    0.0        0.6        0.6      0.0   \n",
      "1231  0.008968 -0.240932  -0.005    0.0        0.6        0.6      0.0   \n",
      "2485  0.000039 -0.096779   0.000    0.0        0.6        0.6      0.0   \n",
      "2560  0.000007 -0.157642   0.000    0.0        0.6        0.6      0.0   \n",
      "\n",
      "           alt-ft   ai-pitch   ai-roll    ...      latitude   longitude  \\\n",
      "1127  1561.524658  13.268087 -0.298852    ...     21.325216 -157.876967   \n",
      "705    489.034210  15.768716 -0.093013    ...     21.325215 -157.908981   \n",
      "1244  1862.573364  12.646906  0.052254    ...     21.325217 -157.867545   \n",
      "2348  4398.859375   6.650670 -0.028379    ...     21.325213 -157.762236   \n",
      "1723  3046.966309  10.049761 -0.145561    ...     21.325217 -157.825966   \n",
      "1829  3290.355225   9.464966 -0.256534    ...     21.325216 -157.816049   \n",
      "1909  3477.626221   9.025006 -0.119101    ...     21.325215 -157.808338   \n",
      "1548  2625.143066  11.022375 -0.106676    ...     21.325216 -157.841876   \n",
      "1678  2938.737305  10.307766  0.042749    ...     21.325217 -157.830193   \n",
      "2044  3783.056885   8.271134 -0.236792    ...     21.325214 -157.794790   \n",
      "2440  4947.656250  21.153435 -0.003755    ...     21.325231 -157.752734   \n",
      "978   1186.252686  14.016886  0.253374    ...     21.325217 -157.888656   \n",
      "2553  5393.520020   4.895000  0.000117    ...     21.325289 -157.742541   \n",
      "1860  3364.595703   9.286540 -0.009085    ...     21.325216 -157.813039   \n",
      "2490  5311.295410  10.911972  0.001381    ...     21.325258 -157.748308   \n",
      "403   -351.567535  18.061232 -1.148370    ...     21.325228 -157.930016   \n",
      "759    632.692139  14.880084 -0.006386    ...     21.325215 -157.905074   \n",
      "2146  4001.247314   7.713289 -0.089301    ...     21.325215 -157.784195   \n",
      "1035  1328.816650  13.702678 -0.159200    ...     21.325216 -157.884280   \n",
      "813    764.534546  14.631873 -0.006473    ...     21.325214 -157.901100   \n",
      "1672  2924.600098  10.341296 -0.149097    ...     21.325216 -157.830737   \n",
      "2514  5380.664063   6.953203  0.000352    ...     21.325271 -157.746129   \n",
      "1062  1396.534424  13.575165 -0.060175    ...     21.325217 -157.882168   \n",
      "2508  5369.681641   7.728215  0.000587    ...     21.325268 -157.746659   \n",
      "839    827.088684  14.648857 -0.134522    ...     21.325214 -157.899216   \n",
      "2045  3784.906738   8.266264 -0.256221    ...     21.325214 -157.794703   \n",
      "1494  2491.077148  11.321819 -0.275092    ...     21.325215 -157.846643   \n",
      "2008  3703.135742   8.471045  0.202034    ...     21.325215 -157.798468   \n",
      "1730  3062.876709  10.012141 -0.060056    ...     21.325217 -157.825335   \n",
      "936   1077.973022  14.305621 -0.274239    ...     21.325215 -157.891883   \n",
      "...           ...        ...       ...    ...           ...         ...   \n",
      "1929  3524.962646   8.911856 -0.010782    ...     21.325214 -157.806325   \n",
      "411   -337.292236  16.654285 -0.961068    ...     21.325224 -157.929485   \n",
      "1325  2067.379883  12.226906 -0.033668    ...     21.325216 -157.860966   \n",
      "2324  4353.623047   6.773822 -0.073462    ...     21.325213 -157.764948   \n",
      "1779  3177.266357   9.739840 -0.040963    ...     21.325217 -157.820724   \n",
      "1685  2956.877686  10.263221  0.051761    ...     21.325217 -157.829492   \n",
      "1284  1962.533813  12.440179 -0.155796    ...     21.325216 -157.864360   \n",
      "2284  4277.004395   6.985087  0.218683    ...     21.325214 -157.769402   \n",
      "1290  1978.318848  12.408360 -0.110728    ...     21.325216 -157.863852   \n",
      "751    611.585449  14.986720  0.052388    ...     21.325215 -157.905683   \n",
      "1066  1407.113525  13.555422 -0.009342    ...     21.325217 -157.881837   \n",
      "1301  2006.604126  12.350827 -0.000660    ...     21.325216 -157.862940   \n",
      "445   -222.617310  20.186295 -0.355182    ...     21.325212 -157.926998   \n",
      "551    136.052567  14.483713  0.029283    ...     21.325216 -157.919749   \n",
      "810    756.301636  14.632293 -0.037447    ...     21.325214 -157.901350   \n",
      "1411  2282.604736  11.775500 -0.176242    ...     21.325215 -157.853821   \n",
      "466   -134.423981  19.982450 -0.320970    ...     21.325210 -157.925545   \n",
      "539    109.298225  14.939694  0.062569    ...     21.325215 -157.920614   \n",
      "1917  3497.254395   8.979030 -0.251015    ...     21.325214 -157.807507   \n",
      "544    120.411606  14.725044  0.063731    ...     21.325215 -157.920269   \n",
      "2153  4015.293701   7.677539 -0.131142    ...     21.325214 -157.783483   \n",
      "2345  4394.328125   6.662878  0.049853    ...     21.325213 -157.762511   \n",
      "1760  3132.114990   9.849548 -0.019403    ...     21.325216 -157.822560   \n",
      "1001  1243.409546  13.878988 -0.128023    ...     21.325216 -157.886916   \n",
      "2150  4008.565918   7.695130 -0.171511    ...     21.325214 -157.783825   \n",
      "2164  4036.098877   7.626311  0.026160    ...     21.325214 -157.782420   \n",
      "2334  4372.744141   6.719445 -0.029243    ...     21.325213 -157.763809   \n",
      "1231  1829.671021  12.716496 -0.051087    ...     21.325216 -157.868583   \n",
      "2485  5288.659180  11.921906  0.000402    ...     21.325255 -157.748749   \n",
      "2560  5390.267578   4.983628 -0.000113    ...     21.325292 -157.741897   \n",
      "\n",
      "         altitude  crashed  a_aileron  a_elevator  a_rudder  a_throttle0  \\\n",
      "1127  2048.325418      0.0   0.029796   -0.262491    -0.030          0.6   \n",
      "705    937.096903      0.0   0.009098   -0.348615    -0.005          0.6   \n",
      "1244  2355.915889      0.0  -0.005157   -0.237944    -0.005          0.6   \n",
      "2348  4962.186235      0.0   0.003087   -0.037279    -0.015          0.6   \n",
      "1723  3576.407044      0.0   0.014617   -0.141866    -0.010          0.6   \n",
      "1829  3831.815366      0.0   0.025916   -0.122174    -0.035          0.6   \n",
      "1909  4020.455816      0.0   0.012257   -0.107709    -0.030          0.6   \n",
      "1548  3137.021397      0.0   0.010824   -0.176078    -0.010          0.6   \n",
      "1678  3463.180193      0.0  -0.004433   -0.150609     0.000          0.6   \n",
      "2044  4330.087431      0.0   0.023887   -0.084285    -0.030          0.6   \n",
      "2440  5612.373534      0.0   0.000365   -0.066119     0.000          0.6   \n",
      "978   1654.735860      0.0  -0.025307   -0.294363     0.020          0.6   \n",
      "2553  5967.039601      0.0  -0.000012   -0.157637     0.000          0.6   \n",
      "1860  3906.476205      0.0   0.001013   -0.116492     0.000          0.6   \n",
      "2490  5926.458360      0.0  -0.000138   -0.105747     0.000          0.6   \n",
      "403     60.990788      0.0   0.116593   -0.413050    -0.093          0.6   \n",
      "759   1081.233528      0.0   0.000742   -0.343085    -0.005          0.6   \n",
      "2146  4552.873200      0.0   0.009225   -0.067584    -0.005          0.6   \n",
      "1035  1803.535187      0.0   0.015655   -0.282624    -0.010          0.6   \n",
      "813   1216.358650      0.0   0.000620   -0.332045    -0.030          0.6   \n",
      "1672  3448.411847      0.0   0.014611   -0.151750    -0.005          0.6   \n",
      "2514  5972.572440      0.0  -0.000034   -0.136049     0.000          0.6   \n",
      "1062  1874.572443      0.0   0.006000   -0.276795     0.015          0.6   \n",
      "2508  5966.546178      0.0  -0.000060   -0.129522     0.000          0.6   \n",
      "839   1281.487167      0.0   0.013155   -0.325363    -0.010          0.6   \n",
      "2045  4331.971306      0.0   0.025788   -0.084145    -0.030          0.6   \n",
      "1494  2998.488266      0.0   0.027593   -0.186937    -0.025          0.6   \n",
      "2008  4248.807673      0.0  -0.020444   -0.090413     0.015          0.6   \n",
      "1730  3593.090119      0.0   0.005814   -0.140574    -0.010          0.6   \n",
      "936   1542.360774      0.0   0.027251   -0.302713    -0.020          0.6   \n",
      "...           ...      ...        ...         ...       ...          ...   \n",
      "1929  4068.268703      0.0   0.001064   -0.104059     0.000          0.6   \n",
      "411     81.118342      0.0   0.094607   -0.425443    -0.070          0.6   \n",
      "1325  2564.052125      0.0   0.003209   -0.221330     0.005          0.6   \n",
      "2324  4915.395463      0.0   0.007082   -0.040726    -0.015          0.6   \n",
      "1779  3713.217958      0.0   0.004176   -0.131285     0.010          0.6   \n",
      "1685  3482.126820      0.0  -0.005064   -0.149160    -0.005          0.6   \n",
      "1284  2457.335708      0.0   0.015653   -0.229869    -0.010          0.6   \n",
      "2284  4836.310669      0.0  -0.021958   -0.046522     0.005          0.6   \n",
      "1290  2473.380805      0.0   0.010919   -0.228582    -0.010          0.6   \n",
      "751   1059.983603      0.0  -0.005256   -0.344145    -0.005          0.6   \n",
      "1066  1885.686217      0.0   0.000759   -0.275881     0.025          0.6   \n",
      "1301  2502.151332      0.0   0.000164   -0.226280    -0.030          0.6   \n",
      "445    218.438978      0.0   0.035546   -0.376296    -0.070          0.6   \n",
      "551    570.012749      0.0  -0.002902   -0.398182     0.010          0.6   \n",
      "810   1207.815002      0.0   0.003630   -0.332896    -0.020          0.6   \n",
      "1411  2784.085854      0.0   0.017333   -0.203841    -0.020          0.6   \n",
      "466    312.590222      0.0   0.032167   -0.368950    -0.070          0.6   \n",
      "539    545.412243      0.0  -0.006290   -0.396099     0.010          0.6   \n",
      "1917  4040.282590      0.0   0.024885   -0.106186    -0.025          0.6   \n",
      "544    555.546585      0.0  -0.006347   -0.397225     0.005          0.6   \n",
      "2153  4567.250414      0.0   0.012902   -0.066504    -0.010          0.6   \n",
      "2345  4957.499869      0.0  -0.004753   -0.037625    -0.010          0.6   \n",
      "1760  3665.760833      0.0   0.001770   -0.134933     0.000          0.6   \n",
      "1001  1714.252625      0.0   0.012755   -0.289789    -0.010          0.6   \n",
      "2150  4560.364982      0.0   0.017190   -0.067016    -0.005          0.6   \n",
      "2164  4588.580756      0.0  -0.002436   -0.064883    -0.030          0.6   \n",
      "2334  4935.168566      0.0   0.002843   -0.039292     0.005          0.6   \n",
      "1231  2322.605277      0.0   0.004921   -0.240579     0.000          0.6   \n",
      "2485  5909.247453      0.0  -0.000044   -0.099098     0.000          0.6   \n",
      "2560  5963.181548      0.0   0.000012   -0.157511     0.000          0.6   \n",
      "\n",
      "      a_throttle1  fly_mode  \n",
      "1127          0.6         1  \n",
      "705           0.6         1  \n",
      "1244          0.6         1  \n",
      "2348          0.6         1  \n",
      "1723          0.6         1  \n",
      "1829          0.6         1  \n",
      "1909          0.6         1  \n",
      "1548          0.6         1  \n",
      "1678          0.6         1  \n",
      "2044          0.6         1  \n",
      "2440          0.6         1  \n",
      "978           0.6         1  \n",
      "2553          0.6         1  \n",
      "1860          0.6         1  \n",
      "2490          0.6         1  \n",
      "403           0.6         1  \n",
      "759           0.6         1  \n",
      "2146          0.6         1  \n",
      "1035          0.6         1  \n",
      "813           0.6         1  \n",
      "1672          0.6         1  \n",
      "2514          0.6         1  \n",
      "1062          0.6         1  \n",
      "2508          0.6         1  \n",
      "839           0.6         1  \n",
      "2045          0.6         1  \n",
      "1494          0.6         1  \n",
      "2008          0.6         1  \n",
      "1730          0.6         1  \n",
      "936           0.6         1  \n",
      "...           ...       ...  \n",
      "1929          0.6         1  \n",
      "411           0.6         1  \n",
      "1325          0.6         1  \n",
      "2324          0.6         1  \n",
      "1779          0.6         1  \n",
      "1685          0.6         1  \n",
      "1284          0.6         1  \n",
      "2284          0.6         1  \n",
      "1290          0.6         1  \n",
      "751           0.6         1  \n",
      "1066          0.6         1  \n",
      "1301          0.6         1  \n",
      "445           0.6         1  \n",
      "551           0.6         1  \n",
      "810           0.6         1  \n",
      "1411          0.6         1  \n",
      "466           0.6         1  \n",
      "539           0.6         1  \n",
      "1917          0.6         1  \n",
      "544           0.6         1  \n",
      "2153          0.6         1  \n",
      "2345          0.6         1  \n",
      "1760          0.6         1  \n",
      "1001          0.6         1  \n",
      "2150          0.6         1  \n",
      "2164          0.6         1  \n",
      "2334          0.6         1  \n",
      "1231          0.6         1  \n",
      "2485          0.6         1  \n",
      "2560          0.6         1  \n",
      "\n",
      "[226 rows x 38 columns]\n",
      "        aileron  elevator  rudder  flaps  throttle0  throttle1  vsi-fpm  \\\n",
      "26032 -0.000006  0.089364     0.0    0.0        0.6        0.6      0.0   \n",
      "26595 -0.000005  0.089549     0.0    0.0        0.6        0.6      0.0   \n",
      "12331 -0.000004  0.084998     0.0    0.0        0.6        0.6      0.0   \n",
      "26030 -0.000006  0.089364     0.0    0.0        0.6        0.6      0.0   \n",
      "29836  0.000002  0.090572     0.0    0.0        0.6        0.6      0.0   \n",
      "24228  0.000003  0.088809     0.0    0.0        0.6        0.6      0.0   \n",
      "17533 -0.000005  0.086689     0.0    0.0        0.6        0.6      0.0   \n",
      "11253 -0.000006  0.084647     0.0    0.0        0.6        0.6      0.0   \n",
      "3569  -0.000001  0.043345     0.0    0.0        0.6        0.6      0.0   \n",
      "12386 -0.000002  0.085011     0.0    0.0        0.6        0.6      0.0   \n",
      "9185  -0.000002  0.083968     0.0    0.0        0.6        0.6      0.0   \n",
      "11161 -0.000007  0.084610     0.0    0.0        0.6        0.6      0.0   \n",
      "6667  -0.000007  0.083148     0.0    0.0        0.6        0.6      0.0   \n",
      "10465 -0.000006  0.084393     0.0    0.0        0.6        0.6      0.0   \n",
      "5053   0.000000  0.080722     0.0    0.0        0.6        0.6      0.0   \n",
      "26827 -0.000006  0.089614     0.0    0.0        0.6        0.6      0.0   \n",
      "10680 -0.000009  0.084455     0.0    0.0        0.6        0.6      0.0   \n",
      "27811 -0.000002  0.089929     0.0    0.0        0.6        0.6      0.0   \n",
      "18193 -0.000011  0.086897     0.0    0.0        0.6        0.6      0.0   \n",
      "4295   0.000002  0.073204     0.0    0.0        0.6        0.6      0.0   \n",
      "13053 -0.000005  0.085230     0.0    0.0        0.6        0.6      0.0   \n",
      "29355  0.000001  0.090416     0.0    0.0        0.6        0.6      0.0   \n",
      "8123  -0.000002  0.083626     0.0    0.0        0.6        0.6      0.0   \n",
      "22188 -0.000002  0.088173     0.0    0.0        0.6        0.6      0.0   \n",
      "5178  -0.000002  0.081184     0.0    0.0        0.6        0.6      0.0   \n",
      "25498 -0.000003  0.089207     0.0    0.0        0.6        0.6      0.0   \n",
      "9131  -0.000003  0.083949     0.0    0.0        0.6        0.6      0.0   \n",
      "9947   0.000000  0.084220     0.0    0.0        0.6        0.6      0.0   \n",
      "11528 -0.000003  0.084728     0.0    0.0        0.6        0.6      0.0   \n",
      "16750  0.000005  0.086435     0.0    0.0        0.6        0.6      0.0   \n",
      "...         ...       ...     ...    ...        ...        ...      ...   \n",
      "3119  -0.000005 -0.007531     0.0    0.0        0.6        0.6      0.0   \n",
      "5327  -0.000004  0.081634     0.0    0.0        0.6        0.6      0.0   \n",
      "16353  0.000002  0.086312     0.0    0.0        0.6        0.6      0.0   \n",
      "10784 -0.000007  0.084493     0.0    0.0        0.6        0.6      0.0   \n",
      "5031  -0.000002  0.080616     0.0    0.0        0.6        0.6      0.0   \n",
      "13154 -0.000003  0.085269     0.0    0.0        0.6        0.6      0.0   \n",
      "10193 -0.000007  0.084306     0.0    0.0        0.6        0.6      0.0   \n",
      "3174   0.000000  0.000855     0.0    0.0        0.6        0.6      0.0   \n",
      "21270 -0.000001  0.087872     0.0    0.0        0.6        0.6      0.0   \n",
      "22289 -0.000002  0.088190     0.0    0.0        0.6        0.6      0.0   \n",
      "5467  -0.000001  0.081954     0.0    0.0        0.6        0.6      0.0   \n",
      "24584 -0.000009  0.088919     0.0    0.0        0.6        0.6      0.0   \n",
      "12955 -0.000002  0.085213     0.0    0.0        0.6        0.6      0.0   \n",
      "19135 -0.000003  0.087205     0.0    0.0        0.6        0.6      0.0   \n",
      "20743 -0.000002  0.087708     0.0    0.0        0.6        0.6      0.0   \n",
      "4296  -0.000001  0.073230     0.0    0.0        0.6        0.6      0.0   \n",
      "26430 -0.000003  0.089498     0.0    0.0        0.6        0.6      0.0   \n",
      "8110  -0.000004  0.083627     0.0    0.0        0.6        0.6      0.0   \n",
      "3423  -0.000004  0.030876     0.0    0.0        0.6        0.6      0.0   \n",
      "6764  -0.000007  0.083168     0.0    0.0        0.6        0.6      0.0   \n",
      "17281 -0.000009  0.086605     0.0    0.0        0.6        0.6      0.0   \n",
      "29821  0.000002  0.090552     0.0    0.0        0.6        0.6      0.0   \n",
      "14930  0.000002  0.085864     0.0    0.0        0.6        0.6      0.0   \n",
      "28589  0.000004  0.090179     0.0    0.0        0.6        0.6      0.0   \n",
      "9241  -0.000002  0.083989     0.0    0.0        0.6        0.6      0.0   \n",
      "9842  -0.000001  0.084190     0.0    0.0        0.6        0.6      0.0   \n",
      "24605 -0.000005  0.088920     0.0    0.0        0.6        0.6      0.0   \n",
      "24859 -0.000009  0.089000     0.0    0.0        0.6        0.6      0.0   \n",
      "15857 -0.000004  0.086154     0.0    0.0        0.6        0.6      0.0   \n",
      "27224 -0.000005  0.089744     0.0    0.0        0.6        0.6      0.0   \n",
      "\n",
      "            alt-ft  ai-pitch   ai-roll    ...      latitude   longitude  \\\n",
      "26032  6746.661621  1.494605  0.000061    ...     21.266096 -154.228556   \n",
      "26595  6747.792480  1.489422  0.000034    ...     21.263705 -154.143258   \n",
      "12331  6718.653809  1.623960  0.000028    ...     21.310525 -156.304914   \n",
      "26030  6746.661621  1.494584  0.000059    ...     21.266103 -154.228812   \n",
      "29836  6754.338379  1.458712 -0.000009    ...     21.249059 -153.651497   \n",
      "24228  6743.039063  1.511392 -0.000033    ...     21.273458 -154.502023   \n",
      "17533  6729.481445  1.574278  0.000052    ...     21.296759 -155.516105   \n",
      "11253  6716.447266  1.633970  0.000060    ...     21.312908 -156.468254   \n",
      "3569   6444.905762  3.015855 -0.000003    ...     21.325087 -157.623513   \n",
      "12386  6718.768555  1.623436  0.000020    ...     21.310399 -156.296593   \n",
      "9185   6712.110840  1.653939  0.000026    ...     21.317034 -156.781551   \n",
      "11161  6716.213379  1.635159  0.000069    ...     21.313104 -156.482205   \n",
      "6667   6706.770020  1.678670  0.000062    ...     21.321275 -157.162884   \n",
      "10465  6714.813965  1.641412  0.000052    ...     21.314549 -156.587681   \n",
      "5053   6690.839844  1.753792 -0.000006    ...     21.323529 -157.407091   \n",
      "26827  6748.262695  1.487176  0.000058    ...     21.262709 -154.108150   \n",
      "10680  6715.224609  1.639609  0.000094    ...     21.314111 -156.555161   \n",
      "27811  6750.236816  1.478097  0.000004    ...     21.258392 -153.959048   \n",
      "18193  6730.826660  1.568059  0.000131    ...     21.294739 -155.415953   \n",
      "4295   6640.737793  1.999912  0.000021    ...     21.324425 -157.520198   \n",
      "13053  6720.189453  1.616777  0.000048    ...     21.308836 -156.195219   \n",
      "29355  6753.354492  1.463480 -0.000016    ...     21.251322 -153.724385   \n",
      "8123   6709.905762  1.664219  0.000029    ...     21.318929 -156.942546   \n",
      "22188  6738.958496  1.530202  0.000008    ...     21.281208 -154.810316   \n",
      "5178   6693.792969  1.742138  0.000025    ...     21.323369 -157.388258   \n",
      "25498  6745.588867  1.499626  0.000029    ...     21.268323 -154.309509   \n",
      "9131   6711.979980  1.654697  0.000024    ...     21.317134 -156.789741   \n",
      "9947   6713.671875  1.646956  0.000003    ...     21.315583 -156.666242   \n",
      "11528  6716.967773  1.631743  0.000021    ...     21.312316 -156.426644   \n",
      "16750  6727.883301  1.581662 -0.000043    ...     21.299080 -155.635194   \n",
      "...            ...       ...       ...    ...           ...         ...   \n",
      "3119   6115.783691  4.753068 -0.000012    ...     21.325308 -157.681007   \n",
      "5327   6697.085938  1.722257  0.000055    ...     21.323173 -157.365587   \n",
      "16353  6727.115723  1.584883 -0.000023    ...     21.300222 -155.695495   \n",
      "10784  6715.464355  1.638480  0.000076    ...     21.313896 -156.539418   \n",
      "5031   6690.093262  1.758279  0.000009    ...     21.323557 -157.410418   \n",
      "13154  6720.439941  1.615508  0.000029    ...     21.308593 -156.179847   \n",
      "10193  6714.202148  1.644439  0.000066    ...     21.315096 -156.628881   \n",
      "3174   6169.791016  4.474001 -0.000005    ...     21.325292 -157.674321   \n",
      "21270  6737.104492  1.538755  0.000010    ...     21.284515 -154.949406   \n",
      "22289  6739.139160  1.529437  0.000030    ...     21.280836 -154.794946   \n",
      "5467   6698.941406  1.717180  0.000010    ...     21.322987 -157.344402   \n",
      "24584  6743.734863  1.508224  0.000087    ...     21.272054 -154.448505   \n",
      "12955  6720.007324  1.617580  0.000019    ...     21.309069 -156.210069   \n",
      "19135  6732.802734  1.558583  0.000035    ...     21.291746 -155.272909   \n",
      "20743  6736.003906  1.544043  0.000013    ...     21.286364 -155.029462   \n",
      "4296   6640.834473  1.999976  0.000021    ...     21.324424 -157.520084   \n",
      "26430  6747.514648  1.490363  0.000043    ...     21.264410 -154.168247   \n",
      "8110   6709.884277  1.664279  0.000035    ...     21.318952 -156.944583   \n",
      "3423   6363.696777  3.449435  0.000028    ...     21.325179 -157.642927   \n",
      "6764   6706.962402  1.677992  0.000067    ...     21.321127 -157.148170   \n",
      "17281  6728.976074  1.576567  0.000108    ...     21.297515 -155.554382   \n",
      "29821  6754.273438  1.459278 -0.000018    ...     21.249127 -153.653675   \n",
      "14930  6724.201660  1.598180 -0.000022    ...     21.304120 -155.910864   \n",
      "28589  6751.849121  1.470335 -0.000032    ...     21.254864 -153.840559   \n",
      "9241   6712.243652  1.653265  0.000021    ...     21.316930 -156.773104   \n",
      "9842   6713.511230  1.647448  0.000009    ...     21.315787 -156.682122   \n",
      "24605  6743.816406  1.507645  0.000066    ...     21.271968 -154.445282   \n",
      "24859  6744.333496  1.505174  0.000083    ...     21.270945 -154.406739   \n",
      "15857  6726.107422  1.589449  0.000041    ...     21.301613 -155.770541   \n",
      "27224  6749.103516  1.483092  0.000032    ...     21.260979 -154.047828   \n",
      "\n",
      "          altitude  crashed     a_aileron  a_elevator  a_rudder  a_throttle0  \\\n",
      "26032  7372.091602      0.0 -6.000000e-06    0.089364       0.0          0.6   \n",
      "26595  7373.286687      0.0 -3.400000e-06    0.089552       0.0          0.6   \n",
      "12331  7343.804783      0.0 -2.900000e-06    0.085001       0.0          0.6   \n",
      "26030  7372.091600      0.0 -6.000000e-06    0.089364       0.0          0.6   \n",
      "29836  7379.912433      0.0  9.000000e-07    0.090570       0.0          0.6   \n",
      "24228  7368.471943      0.0  3.400000e-06    0.088808       0.0          0.6   \n",
      "17533  7354.753465      0.0 -5.100000e-06    0.086694       0.0          0.6   \n",
      "11253  7341.538769      0.0 -6.000000e-06    0.084648       0.0          0.6   \n",
      "3569   7066.898224      0.0  5.000000e-07    0.043536       0.0          0.6   \n",
      "12386  7343.900899      0.0 -2.000000e-06    0.085015       0.0          0.6   \n",
      "9185   7337.145363      0.0 -2.600000e-06    0.083969       0.0          0.6   \n",
      "11161  7341.292877      0.0 -7.000000e-06    0.084610       0.0          0.6   \n",
      "6667   7331.801993      0.0 -6.300000e-06    0.083147       0.0          0.6   \n",
      "10465  7339.893542      0.0 -5.100000e-06    0.084393       0.0          0.6   \n",
      "5053   7315.964128      0.0  5.000000e-07    0.080731       0.0          0.6   \n",
      "26827  7373.711997      0.0 -6.000000e-06    0.089614       0.0          0.6   \n",
      "10680  7340.294041      0.0 -9.600000e-06    0.084455       0.0          0.6   \n",
      "27811  7375.760934      0.0 -3.000000e-07    0.089933       0.0          0.6   \n",
      "18193  7356.096717      0.0 -1.300000e-05    0.086900       0.0          0.6   \n",
      "4295   7266.236091      0.0 -2.000000e-06    0.073246       0.0          0.6   \n",
      "13053  7345.313027      0.0 -4.800000e-06    0.085230       0.0          0.6   \n",
      "29355  7378.924002      0.0  1.500000e-06    0.090419       0.0          0.6   \n",
      "8123   7334.921019      0.0 -2.900000e-06    0.083627       0.0          0.6   \n",
      "22188  7364.351672      0.0 -9.000000e-07    0.088172       0.0          0.6   \n",
      "5178   7318.842690      0.0 -2.600000e-06    0.081190       0.0          0.6   \n",
      "25498  7371.060745      0.0 -2.900000e-06    0.089209       0.0          0.6   \n",
      "9131   7337.012411      0.0 -2.600000e-06    0.083949       0.0          0.6   \n",
      "9947   7338.768182      0.0 -3.000000e-07    0.084223       0.0          0.6   \n",
      "11528  7342.055421      0.0 -2.100000e-06    0.084729       0.0          0.6   \n",
      "16750  7353.105831      0.0  4.300000e-06    0.086438       0.0          0.6   \n",
      "...            ...      ...           ...         ...       ...          ...   \n",
      "3119   6726.776191      0.0  1.400000e-06   -0.007118       0.0          0.6   \n",
      "5327   7322.080359      0.0 -5.300000e-06    0.081639       0.0          0.6   \n",
      "16353  7352.317640      0.0  2.200000e-06    0.086312       0.0          0.6   \n",
      "10784  7340.542341      0.0 -7.500000e-06    0.084493       0.0          0.6   \n",
      "5031   7315.209763      0.0 -8.000000e-07    0.080625       0.0          0.6   \n",
      "13154  7345.571735      0.0 -2.900000e-06    0.085270       0.0          0.6   \n",
      "10193  7339.320839      0.0 -6.700000e-06    0.084308       0.0          0.6   \n",
      "3174   6782.453822      0.0  5.000000e-07    0.001227       0.0          0.6   \n",
      "21270  7362.423682      0.0 -9.000000e-07    0.087872       0.0          0.6   \n",
      "22289  7364.479803      0.0 -2.900000e-06    0.088190       0.0          0.6   \n",
      "5467   7323.940295      0.0 -1.000000e-06    0.081960       0.0          0.6   \n",
      "24584  7369.189640      0.0 -8.500000e-06    0.088920       0.0          0.6   \n",
      "12955  7345.185653      0.0 -1.900000e-06    0.085213       0.0          0.6   \n",
      "19135  7358.089546      0.0 -3.600000e-06    0.087204       0.0          0.6   \n",
      "20743  7361.358398      0.0 -1.200000e-06    0.087712       0.0          0.6   \n",
      "4296   7266.332996      0.0 -2.000000e-06    0.073266       0.0          0.6   \n",
      "26430  7372.969465      0.0 -4.400000e-06    0.089497       0.0          0.6   \n",
      "8110   7334.921026      0.0 -3.400000e-06    0.083627       0.0          0.6   \n",
      "3423   6982.781966      0.0 -2.900000e-06    0.031048       0.0          0.6   \n",
      "6764   7331.947778      0.0 -6.800000e-06    0.083169       0.0          0.6   \n",
      "17281  7354.199172      0.0 -1.090000e-05    0.086606       0.0          0.6   \n",
      "29821  7379.801903      0.0  1.900000e-06    0.090553       0.0          0.6   \n",
      "14930  7349.411673      0.0  2.200000e-06    0.085864       0.0          0.6   \n",
      "28589  7377.378103      0.0  3.200000e-06    0.090179       0.0          0.6   \n",
      "9241   7337.280724      0.0 -2.000000e-06    0.083989       0.0          0.6   \n",
      "9842   7338.575119      0.0 -9.000000e-07    0.084190       0.0          0.6   \n",
      "24605  7369.220045      0.0 -6.300000e-06    0.088920       0.0          0.6   \n",
      "24859  7369.742288      0.0 -8.200000e-06    0.089000       0.0          0.6   \n",
      "15857  7351.297984      0.0 -4.100000e-06    0.086154       0.0          0.6   \n",
      "27224  7374.569014      0.0 -3.100000e-06    0.089745       0.0          0.6   \n",
      "\n",
      "       a_throttle1  fly_mode  \n",
      "26032          0.6         2  \n",
      "26595          0.6         2  \n",
      "12331          0.6         2  \n",
      "26030          0.6         2  \n",
      "29836          0.6         2  \n",
      "24228          0.6         2  \n",
      "17533          0.6         2  \n",
      "11253          0.6         2  \n",
      "3569           0.6         2  \n",
      "12386          0.6         2  \n",
      "9185           0.6         2  \n",
      "11161          0.6         2  \n",
      "6667           0.6         2  \n",
      "10465          0.6         2  \n",
      "5053           0.6         2  \n",
      "26827          0.6         2  \n",
      "10680          0.6         2  \n",
      "27811          0.6         2  \n",
      "18193          0.6         2  \n",
      "4295           0.6         2  \n",
      "13053          0.6         2  \n",
      "29355          0.6         2  \n",
      "8123           0.6         2  \n",
      "22188          0.6         2  \n",
      "5178           0.6         2  \n",
      "25498          0.6         2  \n",
      "9131           0.6         2  \n",
      "9947           0.6         2  \n",
      "11528          0.6         2  \n",
      "16750          0.6         2  \n",
      "...            ...       ...  \n",
      "3119           0.6         2  \n",
      "5327           0.6         2  \n",
      "16353          0.6         2  \n",
      "10784          0.6         2  \n",
      "5031           0.6         2  \n",
      "13154          0.6         2  \n",
      "10193          0.6         2  \n",
      "3174           0.6         2  \n",
      "21270          0.6         2  \n",
      "22289          0.6         2  \n",
      "5467           0.6         2  \n",
      "24584          0.6         2  \n",
      "12955          0.6         2  \n",
      "19135          0.6         2  \n",
      "20743          0.6         2  \n",
      "4296           0.6         2  \n",
      "26430          0.6         2  \n",
      "8110           0.6         2  \n",
      "3423           0.6         2  \n",
      "6764           0.6         2  \n",
      "17281          0.6         2  \n",
      "29821          0.6         2  \n",
      "14930          0.6         2  \n",
      "28589          0.6         2  \n",
      "9241           0.6         2  \n",
      "9842           0.6         2  \n",
      "24605          0.6         2  \n",
      "24859          0.6         2  \n",
      "15857          0.6         2  \n",
      "27224          0.6         2  \n",
      "\n",
      "[2727 rows x 38 columns]\n"
     ]
    }
   ],
   "source": [
    "for tag,group in groups:\n",
    "    print(group.sample(frac=0.1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tensorflow as tf\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = np.array([[0.,1.],[2.,3.],[4.,5.]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = a.T"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0., 2., 4.])"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "sess = tf.InteractiveSession()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0., 2., 4.],\n",
       "       [1., 3., 5.]])"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.astype(np.float)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "step = tf.multiply([0.1,-0.2,0.2], a[1]-a[0]) + a[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.1, 1.8, 4.2], dtype=float32)"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "step.eval()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([2.02839043, 1.29478623])"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.random.normal([1,3],2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "not type( np.array([])) == np.ndarray"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(tuple()) ==  np.ndarray"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
